<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    {{count}}<br/>
<!--    <input type="button" v-on:click="count++" value="+">-->
<!--    <button v-on:click="count&#45;&#45;" >-</button>-->
<!--    @click用于监听某个元素的点击事件，并需要执行被点击时需要执行的方法-->
    <button v-on:click="add">+</button>
    <button v-on:click="sub">-</button>
</div>

<script src="../../project_practice/lunbotu/vue.js"></script>
<script>
  const app = new Vue({
    el:'#app',
    data: {
        count: 0
    },
      methods:{         //用于Vue对象中中定义方法的属性
        add:function () {
            console.log('add被执行');
            this.count++
        },
          sub:function () {
              console.log('sub被执行');
              this.count--
          }
      }
  })
</script>
</body>
</html>